/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package BUS;

import DAO.MyContactDAO;
import DTO.MyContactDTO;
import java.io.IOException;
import java.sql.SQLException;
import java.util.ArrayList;

/**
 *
 * @author Dang Thi Phuong Thao
 */
public class MyContactBUS {
    private MyContactDAO contactDAO = new MyContactDAO();
    public ArrayList<MyContactDTO> layTatCaContact () throws SQLException, IOException{
        return contactDAO.layTatCaContact();
    }
    public MyContactDTO layTatCaContactBangID (String Id) throws SQLException, IOException{
        return (contactDAO.layTatCaContactBangID(Id)).get(0);
    }
    public int themContact (MyContactDTO contactDTO) throws IOException{
        return contactDAO.themContact(contactDTO);
    }
    public MyContactDTO layTatCaContactBangID (int Id) throws SQLException, IOException{
        return (contactDAO.layTatCaContactBangID(String.valueOf(Id))).get(0);
    }
    public int xoaContact(int contactId) throws IOException{
        return  contactDAO.xoaContact(contactId);
    }
    public int capNhatContact (MyContactDTO contactDTO) throws IOException{
        return contactDAO.capNhatContact(contactDTO);
    }
}
